<%-- 
    Document   : list
    Created on : 2014-10-13, 14:59:05
    Author     : liuxulin
--%>
<%@page contentType="text/html; charset=UTF-8" session="false" %>
<%@include  file="/WEB-INF/jspf/import.jspf"%>
<div class="pageHeader">
    <form onsubmit="return navTabSearch(this);" id="pagerForm" name="searchForm" method="post">
        <input type="hidden" name="pageNum" value="${pager.pageNo}" />
        <input type="hidden" name="pageSize" value="${pager.pageSize}" />
        <input type="hidden" name="orderField" value="${orderField}" />
        <input type="hidden" name="orderDirection" value="${orderDirection}" />
        <div class="searchBar">
            <table class="searchContent">
                <tbody>
                    <tr>
                        <td><label>真实姓名：</label><input type="text" name="truename" value="${fn:escapeXml(truename)}" class="textInput"></td>
                        <td>
                            <label>信息状态：</label>
                            <select name="status">
                                <option value="-2" ${status==-2?"selected":""}>请选择</option>
                                <option value="2" ${status==2?"selected":""}>待付款</option>
                                <option value="0" ${status==0?"selected":""}>待发货</option>
                                <option value="1" ${status==1?"selected":""}>已发货</option>
                                <option value="-1" ${status==-1?"selected":""}>驳回</option>
                            </select>
                        </td>
                        <td colspan="2"><label>申请时间：</label>
                            <input type="text" value="${beginDate}" name="beginDate" datefmt="yyyy-MM-dd 00:00:00" class="date" readonly="true">
                            至
                            <input type="text" value="${endDate}" name="endDate" datefmt="yyyy-MM-dd 23:59:59" class="date" readonly="true">
                        </td>
                    </tr>
                </tbody>
            </table>
            <div class="subBar">
                <ul><li><div class="buttonActive"><div class="buttonContent"><button type="button" onclick="exportFile();">导出Excel</button></div></div></li>
                    <li><div class="buttonActive"><div class="buttonContent"><button type="submit">查询</button></div></div></li>
                </ul>
            </div>
        </div>
    </form>
</div>
<div class="panelBar">
</div>                        
<div class="pageContent">
    <table class="table" style="width: 100%" layoutH="136">
        <thead>
            <tr>
                <th width="5%">ID</th>
                <th >用户昵称</th>
                <th >真实姓名</th>
                <th >手机号码</th>
                <th >详细地址</th>
                <th >邮编</th>
                <th >申请礼品</th>
                <th >兑换数量</th>
                <th >申请时间</th>
                <th >处理状态</th>
                <th >操作</th>
            </tr>
        </thead>
        <tbody>
            <c:forEach var="e" items="${pager.resultList}">
                <tr>
                    <td width="5%">${e.conversionId}</td>
                    <td><a href="${UCROOT }/${e.userId}" target="_blank">${fn:escapeXml(e.user.nickname)}</a></td>
                    <td>${fn:escapeXml(e.trueName)}</td>
                    <td>${e.phone}</td>
                    <td>${fn:escapeXml(e.address)}</td>
                    <td>${e.postcode}</td>
                    <td>${e.gift.name}</td>
                    <td>${e.num}</td>
                    <td><fmt:formatDate value="${e.createAt}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
                    <td>${e.status==1?"已发货":e.status==0?"待发货":e.status==-1?"驳回":"待付款"}</td>
                    <td>
                        <c:if test="${e.status==1}">
                            <a target="ajaxToDo" href="${ROOT}/admin/gift/editConversionStatus.do?conversionId=${e.conversionId}&status=0"
                               rel="gift-detail" title="修改记录信息" style="color:blue;">取消发货</a>
                        </c:if>
                        <c:if test="${e.status==0}">
                            <a target="ajaxToDo" href="${ROOT}/admin/gift/editConversionStatus.do?conversionId=${e.conversionId}&status=1"
                               rel="gift-detail" title="请再次确认,是否已经发货？<br/><span style='color:red'>发货后记得短信通知兑换的用户</span>" style="color:blue;">发货</a>
                            <a class="icon" data-url="${ROOT}/admin/gift/rejectMsg.do?conversionId=${e.conversionId}" href="javascript:void(0)" title="确定要驳回吗？"  onclick="checkReject(this);" style="color:blue;">驳回</a>
                        </c:if>
                        <c:if test="${e.status==-1}">

                            <a class="icon" data-url="${ROOT}/admin/gift/rejectMsg.do?conversionId=${e.conversionId}&isRead=1" href="javascript:void(0)"   onclick="checkReject(this);" style="color:blue;">查看驳回理由</a>
                        </c:if>
                    </td>
                </tr>
            </c:forEach>
        </tbody>
    </table>
</div>
<div class="panelBar">
    <div class="pages">
        <span>共 ${pager.total} 条</span>
    </div>
    <div class="pagination" targetType="navTab" totalCount="${pager.total}" numPerPage="${pager.pageSize}" pageNumShown="10" currentPage="${pager.pageNo}"></div>
</div>
<script>
    function checkReject(e){
        var url = $(e).attr("data-url");
        $.pdialog.open(url, "rejectDialog", $(e).attr("title"),{height:300,width:430});
    }
    var beginDate = "${beginDate}";
    var endDate = "${endDate}";
    var truename = "${truename}";
    var status = "${status}";
    function exportFile(){
        location.href="gift/exportConversions.do?beginDate="+beginDate+"&endDate="+endDate+"&truename="+truename+"&status="+status;
    }
</script>
